<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link type="text/css" rel="stylesheet" href="css/style.css">
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
function doit(flag,id)
{
	if(flag=="del")
	{
		if(confirm("确认删除吗？")!=true)
			return;
	}
	window.location = "provider.do?id="+id+"&flag="+flag;
}

$(function(){
	$("#list tr:not(:first)").remove();
	$.ajax({
		url:"findAllPro.action",
		type:"POST",
		success:function(data){
		
			for(var i=0;i<data.pros.length;i++){
				
				$("#list").append(" <tr><td>"+data.pros[i].proId
				+"</td><td>"+data.pros[i].proName
				+"</td><td>"+data.pros[i].description
				+"</td><td>"+data.pros[i].linkMan
				+"</td><td>"+data.pros[i].phone
				+"</td><td>"+data.pros[i].address+"</td></tr>");
			}
		}
	});

	$("#search").click(function(){
		var proName = $("#proName").val();
		var proDesc = $("#proDesc").val();
		alert(proName+":"+proDesc);
		$.ajax({
			url:"findProvider.action",
			type:"POST",
			data:{"proName":proName,"proDesc":proDesc},
			dataType:"json",
			success:function(data){
				$("#list tr:not(:first)").remove();
				for(var i=0;i<data.pros.length;i++){
				
					$("#list").append(" <tr><td>"+data.pros[i].proId
					+"</td><td>"+data.pros[i].proName
					+"</td><td>"+data.pros[i].description
					+"</td><td>"+data.pros[i].linkMan
					+"</td><td>"+data.pros[i].phone
					+"</td><td>"+data.pros[i].address+"</td></tr>");
				}
			}
		});
	});
});
</script>
</head>
<body>
<div class="menu">

<table>
<tbody><tr><td>
<input name="flag" value="search" type="hidden">
供应商名称：<input name="proName" id="proName" class="input-text" value="" type="text"> &nbsp;&nbsp;&nbsp;&nbsp;
供应商描述：<input name="proDesc" id="proDesc" class="input-text" value="" type="text">&nbsp;&nbsp;&nbsp;&nbsp;
<input value="组 合 查 询" type="submit" id="search">
</td></tr>
</tbody></table>
</div>
<div class="main">
<div class="optitle clearfix">
<em><input value="添加数据" class="input-button" onclick="window.location='providerAdd.jsp'" type="button"></em>
		<div class="title">供应商管理&gt;&gt;</div>
	</div>

	<div class="content">
<table class="list" id="list">
  <tr>
    <td width="70" height="29"><div class="STYLE1" align="center">编号</div></td>
    <td width="80"><div class="STYLE1" align="center">供应商名称</div></td>
    <td width="100"><div class="STYLE1" align="center">供应商描述</div></td>
    <td width="100"><div class="STYLE1" align="center">联系人</div></td>

    <td width="100"><div class="STYLE1" align="center">电话</div></td>
    <td width="100"><div class="STYLE1" align="center">地址</div></td>
  </tr>
 

</table>
	</div>
</div>
</body>
</html>